#ifndef CTP_LINK_BASE_H_
#define CTP_LINK_BASE_H_

#include "THostFtdcTraderApi.h"

#include <string>
#include <sstream>
#include <vector>
using namespace std;



class CtpLinkBase
{
public:
	CtpLinkBase();
	~CtpLinkBase();
	bool setLoginField(CThostFtdcReqUserLoginField *field);
	void loadSettings();

	bool RspError(CThostFtdcRspInfoField *info, const string &name, stringstream &ss);

	static string getSide(TThostFtdcDirectionType side);

protected:
	static const int	mFieldSize = 256;
	char				mBrokerID[mFieldSize];
	char				mUserID[mFieldSize];
	char				mPassword[mFieldSize];
	string				mName;
	char				mInvestor[mFieldSize];
	char				mTradingDay[mFieldSize];

	string				mAllInstruments;
	vector<string>		mInstrumentsVector;
	char**				mInstrumentsArray;
};

#endif //CTP_LINK_BASE_H_